#include ".\bipedmng.h"

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
//VOID	CBipedMng::Init()
//{
//
//}

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
BOOL	CBipedMng::Add( BIPINFO* pBipInfo )
{
	for( m_itBipInfo = m_mpBipInfo.begin() ; m_itBipInfo != m_mpBipInfo.end() ; m_itBipInfo++ )
	{
		BIPINFO*	_pBipInfo = m_itBipInfo->second;

		if( !stricmp( _pBipInfo->szBipName , pBipInfo->szBipName ))
		{
			return FALSE;
		}
	}
	m_mpBipInfo.insert( make_pair( pBipInfo->nIndex , pBipInfo ));

	return TRUE;
}

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
INT		CBipedMng::Find( TCHAR* szBipName )
{
	for( m_itBipInfo = m_mpBipInfo.begin() ; m_itBipInfo != m_mpBipInfo.end() ; m_itBipInfo++ )
	{
        BIPINFO* _pBipInfo = m_itBipInfo->second;

		if( !stricmp( _pBipInfo->szBipName , szBipName ))
		{
			return _pBipInfo->nIndex;
		}
	}
	return -1;
}

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
BIPINFO*	CBipedMng::GetMeshPtr( int nIndex )
{
    m_itBipInfo = m_mpBipInfo.find( nIndex );

	for( map<int , BIPINFO*>::iterator it = m_mpBipInfo.begin();
		it != m_mpBipInfo.end() ;	it++ )
	{
		BIPINFO*	pBipInfo = it->second;		
	}

	if( m_mpBipInfo.end() == m_itBipInfo )
	{
		return NULL;
	}

	BIPINFO*	pBipInfo	= m_itBipInfo->second;

	return pBipInfo;
}

/*--------------------------------------------------------------------------------
	Func : Delete All Std::Map Data
--------------------------------------------------------------------------------*/
VOID	CBipedMng::Release()
{
	if( !m_mpBipInfo.empty() )
	{
		for( m_itBipInfo = m_mpBipInfo.begin() ; m_itBipInfo != m_mpBipInfo.end() ; m_itBipInfo++ )
		{
			BIPINFO*	pBipInfo = m_itBipInfo->second;
			if( pBipInfo )
				delete pBipInfo;

			pBipInfo	= NULL;
		}
		m_mpBipInfo.clear();
		m_itBipInfo	= NULL;
	}
}



































